$("#back").on("click",function(){
    window.location.href = "userlist";
});

$("#editUserBtn").click(function () {
    //收集参数
    var id = $("#devId").val();
    var devName = $.trim($("#devName").val());
    var devPassword = $.trim($("#devPassword").val());
    var reDevPassword = $.trim($("#reDevPassword").val());
    var devEmail = $.trim($("#devEmail").val());
    var devInfo = $.trim($("#devInfo").val());
    //表单验证
    if (devName==""){
        alert("用户名不能为空！")
        return;
    }
    if (devPassword==""){
        alert("密码不能为空！")
        return;
    }
    if (reDevPassword==""){
        alert("请重复输入密码！")
        return;
    }
    if (devEmail==""){
        alert("用户邮箱不能为空！")
        return;
    }
    if (reDevPassword==devPassword){
        //发送异步请求
        $.ajax({
            url:'editUser',
            data:{
                id:id,
                devName:devName,
                devPassword:devPassword,
                devEmail:devEmail,
                devInfo:devInfo
            },
            type:'post',
            dataType:'json',
            success:function (data) {
                if (data.code=="1"){
                    alert("修改用户成功！")
                    return;
                }else {
                    alert(data.message)
                    return;
                }
            }
        })
    }else {
        alert("两次输入的密码不相同！")
        return;
    }
})